#ifndef VIEW_CHANGE_ACK_HPP
#define VIEW_CHANGE_ACK_HPP 1

#include "../Parameters.hpp"
#include "../messages/MacArrayMessage.hpp"
#include "../messages/Digest.hpp"

namespace BFT
{
	namespace order
	{
		namespace messages
		{
			class ViewChangeAck : public BFT::messages::MacArrayMessage
			{
				public:
				
//				We rely on the MACArray of the veriied message to get the
//				appropriate MACs out.  The receiving replica must regenerate this
//				message and authenticate it with the appropriate MAC.
				
				ViewChangeAck(uint32_t view, uint32_t _vc_replica, 
					      boost::shared_ptr<BFT::messages::Digest> _vcd,
					      uint32_t _sendingReplica);
				
				ViewChangeAck(boost::shared_ptr<char> _bytes, int _bytes_size);
				
				uint32_t getViewNo(); //inlined
				
				boost::shared_ptr<BFT::messages::Digest> getVCDigest(); //inlined
				
				uint32_t getChangingReplica(); //inlined
				
				bool equals(boost::shared_ptr<ViewChangeAck> _other_vca);
				
				protected:
				
				uint32_t viewNo;
				uint32_t sourceReplica;
				boost::shared_ptr<BFT::messages::Digest> vcDigest;
				
				private:
				
				static uint32_t computeSize();
				
				
				
			};
			
			inline uint32_t ViewChangeAck::getViewNo() {return viewNo;}
			inline uint32_t ViewChangeAck::getChangingReplica() {return sourceReplica;}
			inline boost::shared_ptr<BFT::messages::Digest> ViewChangeAck::getVCDigest() {return vcDigest;}
		}
	}
}

#endif
